#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//#include <immintrin.h>
//#include <emmintrin.h>
#define int __int128
#define ll __int128
#define fi first
#define se second
#define ls(x) ((x)*2)
#define rs(x) ((x)*2+1)
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define Rof(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define rep(i,  b) for(int i=1,i##end=b;i<=i##end;i++)
using namespace std;
const int N=2e6+5,base=999983,Mod=1e9+7;
//char buf[(1<<21)+5],*p1,*p2;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline void chmx(int &x,int y){(x<y)&&(x=y);}
inline void chmn(int &x,int y){(x>y)&&(x=y);}
inline void Add(int &x,int y){(x=x+y+Mod)%=Mod;}
inline int read(){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?-x:x;
}
void print(int n){
    if(n<0){
        putchar('-');
        n*=-1;
    }
    if(n>9) print(n/10);
    putchar(n%10+'0');
}
int c,T,n,k,a[N],b[N],lst[N];
ll qzh[N];
ll ans=0;
inline ll calc(int t,int va){
	int x=va;
	ll res=(__int128)x*b[t];
	bool flag=0;
	Rof(j,t-1,1){
		int p=min(a[j]-x,a[j-1]);
		res+=p*b[j];
		if(p==lst[j]){
			For(k,j,t-1){
				qzh[k]=qzh[k-1]+lst[k]*b[k];
			}
			res+=qzh[j-1];
			flag=1;
			break;
		}
		lst[j]=p;
		x=p;
	}
	if(!flag){
		For(k,1,t-1){
			qzh[k]=qzh[k-1]+lst[k]*b[k];
		}
	}
	x=va;flag=0;
	For(j,t+1,n){
		int p=min(a[j-1]-x,a[j]);
		res+=p*b[j];
		if(p==lst[j]){
			Rof(k,j,t+1) qzh[k]=qzh[k+1]+lst[k]*b[k];
			res+=qzh[j+1];
			flag=1;
			break;
		}
		lst[j]=p;
		x=p;
	}
	if(!flag){
		Rof(k,n,t+1) qzh[k]=qzh[k+1]+lst[k]*b[k];
	}
	ans=max(ans,res);
	return res;
} 
inline void solve(){
	ans=0;
	n=read(),k=read();
	For(i,1,n-1) a[i]=read();
	int mx=0;
	For(j,1,k) {
		int x=read();
		b[j]+=x;
		b[j+n-k+1]-=x;
	}
	For(j,1,n) b[j]+=b[j-1];
	For(j,1,n)mx=max(mx,b[j]);
	b[0]=b[n+1]=0;
	For(i,0,n+1) lst[i]=-1;
	qzh[0]=qzh[n+1]=0;
	a[0]=1e12;a[n]=1e12;
	//~ For(i,1,n) cout<<b[i]<<" ";puts("");
	
	For(t,1,n){
		if(b[t]!=mx) continue;
		if(b[t-1]!=mx&&b[t+1]==mx) continue;
		if(min(a[t-1],a[t])<=400000){
			For(va,0,min(a[t-1],a[t])){
				calc(t,va);
			}
		}
		else{
			int l=0,r=min(a[t-1],a[t]);
			calc(t,r);calc(t,l);
			while(l<=r){
				int mid=(l+r)>>1;
				if(calc(t,mid)>calc(t,mid+1)){
					r=mid-1;
				}else l=mid+1;
			}
		}
		break;
	}
	//~ if(n<=5000){
		//~ For(t,1,n){
			//~ For(i,0,n+1) lst[i]=-1;
			//~ For(j,0,n+1) qzh[j]=0;
			//~ calc(t,min(a[t],a[t-1]));
		//~ }
	//~ }
	print(ans);putchar('\n');
	For(i,0,n+1) b[i]=0;
	For(i,0,n+1) lst[i]=-1;
	qzh[0]=qzh[n+1]=0;
}
signed main(){
	freopen("festival.in","r",stdin);
	freopen("festival.out","w",stdout);
	// ios::sync_with_stdio(false);
	// cin.tie(0); cout.tie(0);
	srand(time(0));
	c=read(),T=read();
	while(T--)solve();
#ifdef LOCAL
    Debug("\nMy Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}
